ds_list_shuffle

语法:

ds_list_shuffle(id);


参数 描述
id The id of the list to shuffle.


返回: N/A(无返回值)


描述

With this function you can shuffle a list, which will re-order all the component values into random positions from those in which they were originally added to the list.

NOTE: This function will shuffle the list items to the same positions every time the game is run afresh due to the fact that GameMaker Studio 2 generates the same initial random seed every time to make debugging code a far easier task. To avoid this behaviour use randomise at the start of your game. This is only true when testing and debugging the game, as the final executable package will not show this behaviour and will be random every play.


例如:

if restart
   {
   ds_list_shuffle(card_list);
   }

The above code will shuffle the list indexed in the variable "card_list" if the variable "restart" is flagged as true.


上一页: DS Lists
下一页: ds_list_sort
© Copyright YoYo Games Ltd. 2018 All Rights Reserved